package errors

import (
	"fmt"
)

// ErrFailed2CreateNATRule 封装创建 NAT 失败消息的结构化数据
type ErrFailed2CreateNATRule struct {
	CloudProviderName string
	PortDescription   string
	PrivatePort       uint64
	PublicPort        uint64
	Reason            string
}

// Error 实现 error 定义的 Error 接口，将结构化的错误消息转为文本日志信息
func (err ErrFailed2CreateNATRule) Error() string {
	return fmt.Sprintf("Failed to create NAT Rule '%s' from private port %v to public port %v on Cloud Provider '%s': %v",
		err.PortDescription, err.PrivatePort, err.PublicPort, err.CloudProviderName, err.Reason)
}
